<p id="notice"><%= notice %></p>

<h1 style="padding-bottom: 20px;">积分</h1>

<div class="well">
<%= search_form_for @q, class: 'form-horizontal' do |f| %>
<fieldset>

<legend>检索条件</legend>
  <div class="form-group">
    <%= f.label :department_dpno_cont, '机构代码', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :department_dpno_cont, class: 'form-control' %>
    </div>
    <%= f.label :bus_type_eq, '业务类型', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= select_tag "q[bus_type_eq]", options_for_select([["全部", '']] + get_types.map{ |type| [type.name, type.id] }), class: 'form-control' %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :acct_name_cont, '客户名称', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :acct_name_cont, class: 'form-control' %>
    </div>
    <%= f.label :id_no_eq, '证件号码', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :id_no_eq, class: 'form-control' %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :stan_eq, '流水号', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :stan_eq, class: 'form-control' %>
    </div>
    <%= f.label :term_type_eq, '定期期限', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= select_tag "q[term_type_eq]", options_for_select([["全部", '']] + get_term_types.map{ |type| [type.name, type.id] }), class: 'form-control' %>
    </div>
  </div>
  <div class="form-group">
    <%= f.label :create_date_gteq, '开始时间', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :create_date_gteq,  {class: 'form-control datepicker'}  %>
    </div>
    <%= f.label :create_date_lteq, '结束时间', class: 'col-sm-2 control-label' %>
    <div class="col-sm-3">
      <%= f.search_field :create_date_lteq,  {class: 'form-control datepicker'}  %>
    </div>
  </div>


  <div class="form-group">
    <div class="col-sm-offset-10 col-sm-2">
      <input name="clear" value="清除" class="clear_filters_btn btn btn-warning" type="button">
      <%= f.submit '搜索', class: 'btn btn-primary' %>
    </div>
  </div>
</fieldset>
<% end %>
</div>

<table class="table table-striped table-hover ">
  <thead>
    <tr>
      <th><%= sort_link(@q, :department_id, '机构号') %></th>
      <th><%= sort_link(@q, :acct_name, '客户名称') %></th>
      <th>证件类型</th>
      <th>证件号码</th>
      <th>电话号码</th>
      <th>业务类型</th>
      <th>账户类型</th>
      <th>账号</th>
      <th><%= sort_link(@q, :create_date, '开户日期') %></th>
      <th>定期金额</th>
      <th>定期期限</th>
      <th>积分值</th>
      <th>流水号</th>
      <th><%= sort_link(@q, :freeze_date, '冻结日期') %></th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @scores.each do |score| %>
      <tr>
        <td><%= score.department.dpno %></td>
        <td><%= score.acct_name %></td>
        <td><%= score.id_type_id %></td>
        <td><%= score.id_no %></td>
        <td><%= score.phone %></td>
        <td><%= score.bus_type.name %></td>
        <td>
          <% if score.acct_type_id == 0 %>
            卡
          <% else %>
            折
          <% end %>
        </td>
        <td><%= score.acct_no %></td>
        <td><%= score.create_date %></td>
        <td><%= score.amount %></td>
        <td><%= score.term_type.name %></td>
        <td><%= score.score %></td>
        <td><%= score.stan %></td>
        <td><%= score.freeze_date %></td>
        <td><%= link_to '查看', score %></td>
        <td><%= link_to '修改', edit_score_path(score) %></td>
        <td><%= link_to '删除', score, method: :delete, data: { confirm: '您确定要删除吗?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to '新增积分', new_score_path %>
